<?php  # Script -- isimg.php

/* Author @ Huoty
 *   Date @ 2015-11-24 16:59:26
 *  Brief @ 
 */

function isImage($filename){
    $types = '.gif|.jpeg|.png|.bmp';//定义检查的图片类型
    if(file_exists($filename)){
        if (($info = @getimagesize($filename))
            return 0;
        $ext = image_type_to_extension($info['2']);
        return stripos($types,$ext);
    }else{
        return false;
    }
}
 
if(isImage('isimg.txt')!==false){
    echo isImage('1.jpg');
    echo '是图片';
}else{
    echo '不是';
}

?>
